local yunzhi = fk.CreateSkill{
  name = "hanqing__yunzhi",
}

Fk:loadTranslationTable{
  ["hanqing__yunzhi"] = "韵致",
  [":hanqing__yunzhi"] = "每局游戏每名角色限一次，出牌阶段，你可以选择一名其他角色并选择一项：1.将你的体力值和手牌数调整至与其相同；"..
  "2.令其将手牌数和体力值调整至与你相同。",

  ["#hanqing__yunzhi"] = "韵致：选择一名未选择过的其他角色执行一项",
  ["hanqing__yunzhi1"] = "你调整体力值和手牌数至与其相同",
  ["hanqing__yunzhi2"] = "其调整体力值和手牌数至与你相同",

  ["$hanqing__yunzhi1"] = "妾获侍殿下，天幸已怀胎矣。",
  ["$hanqing__yunzhi2"] = "对天设誓，异日妾为王后，亦不忘此情！",
}

yunzhi:addEffect("active", {
  anim_type = "control",
  prompt = "#hanqing__yunzhi",
  card_num = 0,
  target_num = 1,
  interaction = UI.ComboBox {choices = {"hanqing__yunzhi1", "hanqing__yunzhi2"}},
  card_filter = Util.FalseFunc,
  target_filter = function(self, player, to_select, selected)
    return #selected == 0 and to_select ~= player and not table.contains(player:getTableMark(yunzhi.name), to_select.id)
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:addTableMark(player, yunzhi.name, target.id)
    local from, to = player, target
    if self.interaction.data == "hanqing__yunzhi2" then
      from, to = target, player
    end
    if from.hp ~= math.min(to.hp, from.maxHp) then
      from.hp = math.min(to.hp, from.maxHp)
      room:broadcastProperty(from, "hp")
      if from.hp <= 0 then
        room:enterDying({
          who = from,
        })
      end
    end
    if from.dead or to.dead then return end
    local n = from:getHandcardNum() - to:getHandcardNum()
    if n > 0 then
      room:askToDiscard(from, {
        min_num = n,
        max_num = n,
        include_equip = false,
        skill_name = yunzhi.name,
        cancelable = false,
      })
    elseif n < 0 then
      from:drawCards(-n, yunzhi.name)
    end
  end,
})

return yunzhi
